<?php

class Functions {

    private $mId;
    private $mName;
    private $mModule;
    private $mUrl;
    private $mIcon;
    private $mSequence;
    private $mIsEnabled;
    private $mIsShow;
//    private $mCreatedAt;
//    private $mUpdatedAt;
    private $mIsLoaded;
    
    public function getId(){
        return $this->mId;
    }
    
    public function setId($value){
        $this->mId = $value;
    }
    
    public function getName(){
        return $this->mName;
    }

    public function setName($value){
        $this->mName = $value;
    }    

    public function getModule(){
        if (($this->mModule != null) && (!$this->mModule->IsLoaded())) {
            $ModuleDao = new ModuleDao();
            $this->mModule = $ModuleDao->getObject($this->mModule->getId());
            if ($this->mModule != null) $this->mModule->setIsLoaded(true);
            }
        return $this->mModule;
    }

    public function setModule($value){
        $this->mModule = $value;
    }    

    public function getUrl(){
        return $this->mUrl;
    }

    public function setUrl($value){
        $this->mUrl = $value;
    }
    
    public function getIcon(){
        return $this->mIcon;
    }

    public function setIcon($value){
        $this->mIcon = $value;
    }
    
    public function getSequence(){
        return $this->mSequence;
    }

    public function setSequence($value){
        $this->mSequence = $value;
    }
    
    public function getIsEnabled(){
        return $this->mIsEnabled;
    }

    public function setIsEnabled($value){
        $this->mIsEnabled = $value;
    }

    public function getIsShow(){
        return $this->mIsShow;
    }
    
    public function setIsShow($value){
        $this->mIsShow = $value;
    }
//
//    public function getCreatedAt(){
//        return $this->mCreatedAt;
//    }
//
//    public function setCreatedAt(){    
//        $this->mCreatedAt = $value;
//    }
//    
//    public function getUpdatedAt(){
//        return $this->mUpdatedAt;
//    }
//
//    public function setUpdatedAt($value){
//        $this->mUpdatedAt = $value;
//    }
    
    public function IsLoaded() {
        return $this->mIsLoaded;
    }

    public function setIsLoaded($value){
        $this->mIsLoaded = $value;
    }
    
    function __construct() {
        $this->mIsLoaded = false;
    }

    public function toArray() {
        $data = array(
                'id' => $this->mId,
                'name' => $this->mName,
                'module_id' => $this->getModule()->getId(),
                'url' => $this->mUrl,
                'icon' => $this->mIcon,
                'sequence' => $this->mSequence,
                'is_enabled' => $this->mIsEnabled,
                'is_show' => $this->mIsShow
        );

        return $data;
    }
    
}
